import {
  generateHighlightNodeForSalePrice
} from '@/utils/bizUtils';
import {
  formatSalePriceType,
} from '@/utils/price';

// 非钢材
export const getSalePriceTypeSingleColumns = (e) => {
  return [
    {
      title: '查看原价格组',
      align: 'center',
      fixed: 'left',
      render: (h, { row }) => {
        return (
          <el-button
            type="text"
            size="large"
            onClick={ () => { e.viewOriginalPGFn(row) } }
          >查看</el-button>
        )
      }
    },
    {
      title: '价格组名称',
      key: 'groupName',
    },
    {
      title: '主城市',
      key: 'cityName',
    },
    {
      title: '业务区域',
      key: 'businessArea',
    },
    {
      title: '是否敏感商品',
      key: 'isPriceSensitive',
      formatter: (row, columns, cellValue) => {
        return cellValue === '1' ? '是' : '否';
      },
    },
    {
      title: '商品管理区域',
      key: 'saleAreaName',
    },
    {
      title: 'SKU编码',
      key: 'skuNo',
    },
    {
      title: '商品名称',
      key: 'productName',
    },
    {
      title: '规格',
      key: 'spec',
    },
    {
      title: '供货计量单位',
      key: 'supplyUnit',
    },
    {
      title: '主计量单位',
      key: 'mainUnit',
    },
    {
      title: '售价类型',
      children: [
        {
          title: '原值',
          key: 'oldSaleType',
          width: 120,
          render: (h, { row }) => {
            return (<span>{ formatSalePriceType(row.oldInput.saleType) }</span>)
          }
        },
        {
          title: '现值',
          key: 'newSaleType',
          width: 120,
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleType, row.nowInput.saleType, formatSalePriceType(row.nowInput.saleType))
          }
        }
      ]
    },
    {
      title: '成本价',
      width: 120,
      children: [
        {
          title: '原值',
          key: 'oldMainUnitPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.mainUnitPrice }</span>)
          }
        },
        {
          title: '现值',
          key: 'newMainUnitPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitPrice, row.nowInput.mainUnitPrice)
          }
        }
      ]
    },
    {
      title: '销售面价',
      width: 120,
      children: [
        {
          title: '原值',
          key: 'oldFacePrice2',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.facePrice2 }</span>)
          }
        },
        {
          title: '现值',
          key: 'newFacePrice2',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.facePrice2, row.nowInput.facePrice2)
          }
        }
      ]
    },
    {
      title: '加价类型',
      key: 'saleTypeStr',
    },
    {
      title: '现金价加价率/加价金额',
      children: [
        {
          title: '原值',
          key: 'oldCashAddRateOrMoney',
          width: 120,
          render: (h, { row }) => {
            return (<span>{ row.oldInput.cashAddRateOrMoney }</span>)
          }
        },
        {
          title: '现值',
          key: 'newCashAddRateOrMoney',
          width: 120,
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashAddRateOrMoney, row.nowInput.cashAddRateOrMoney)
          }
        }
      ]
    },
    {
      title: '现金价',
      children: [{
        title: '原值',
        key: 'oldCashPrice',
        width: 120,
        render: (h, { row }) => {
          return (<span>{ row.oldInput.cashPrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newCashPrice',
        width: 120,
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.cashPrice, row.nowInput.cashPrice)
        }
      }
      ]
    },
    {
      title: '现金价与原现金价浮动率',
      key: 'cashFloatRate',
    },
    {
      title: '现金实时加价率',
      width: 120,
      children: [{
        title: '原值',
        key: 'oldRealCashPriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realCashPriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealCashPriceAddRate',
        width: 120,
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realCashPriceAddRate, row.nowInput.realCashPriceAddRate)
        }
      }
      ]
    },
    {
      title: '费用利润比',
      key: 'profit',
      render: (h, { row }) => {
        return (<span>{ row.nowInput.profit }</span>)
      }
    },
    {
      title: '分销实时价加价率',
      children: [{
        title: '原值',
        key: 'oldRealDistribPriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realDistribPriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealDistribPriceAddRate',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realDistribPriceAddRate, row.nowInput.realDistribPriceAddRate)
        }
      }
      ]
    },
    {
      title: '分销与现金差额/差率',
      children: [{
        title: '原值',
        key: 'oldDistribCashDiffRateOrMoney',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.distribCashDiffRateOrMoney }</span>)
        }
      },
      {
        title: '现值',
        key: 'newDistribCashDiffRateOrMoney',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.distribCashDiffRateOrMoney, row.nowInput.distribCashDiffRateOrMoney)
        }
      }
      ]
    },
    {
      title: '分销价',
      children: [{
        title: '原值',
        key: 'oldCashDistribMoney',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.cashDistribMoney }</span>)
        }
      },
      {
        title: '现值',
        key: 'newCashDistribMoney',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.cashDistribMoney, row.nowInput.cashDistribMoney)
        }
      }
      ]
    },
    {
      title: '售价标准加价金额/比例',
      children: [{
        title: '原值',
        key: 'oldSaleAddRateOrMoney',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.saleAddRateOrMoney }</span>)
        }
      },
      {
        title: '现值',
        key: 'newSaleAddRateOrMoney',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.saleAddRateOrMoney, row.nowInput.saleAddRateOrMoney)
        }
      }
      ]
    },
    {
      title: '售价实时价加价率',
      children: [{
        title: '原值',
        key: 'oldRealSalePriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realSalePriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealSalePriceAddRate',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realSalePriceAddRate, row.nowInput.realSalePriceAddRate)
        }
      }
      ]
    },
    {
      title: '售价',
      children: [{
        title: '原值',
        key: 'oldSalePrice',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.salePrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newSalePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.salePrice, row.nowInput.salePrice)
        }
      }
      ]
    },
    {
      title: '限制展示价',
      children: [{
        title: '原值',
        key: 'oldLimitShowPrice',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.limitShowPrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newLimitShowPrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitShowPrice, row.nowInput.limitShowPrice)
        }
      }
      ]
    },
    {
      title: '限制交易价',
      children: [{
        title: '原值',
        key: 'oldLimitTradePrice',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.limitTradePrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newLimitTradePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitTradePrice, row.nowInput.limitTradePrice)
        }
      }
      ]
    }
  ]
}

// 非钢材
export const getSalePriceTypeMultipleColumns = (e) => {
  return [
    {
      title: '查看原价格组',
      align: 'center',
      fixed: 'left',
      render: (h, { row }) => {
        return (
          <el-button
            type="text"
            size="large"
            onClick={ () => { e.viewOriginalPGFn(row) } }
          >查看</el-button>
        )
      }
    },
    {
      title: '价格组名称',
      key: 'groupName',
    },
    {
      title: '主城市',
      key: 'cityName',
    },
    {
      title: '业务区域',
      key: 'businessArea',
    },
    {
      title: '是否敏感商品',
      key: 'isPriceSensitive',
      formatter: (row, columns, cellValue) => {
        return cellValue === '1' ? '是' : '否';
      },
    },
    {
      title: '商品管理区域',
      key: 'saleAreaName',
    },
    {
      title: 'SKU编码',
      key: 'skuNo',
    },
    {
      title: '商品名称',
      key: 'productName',
    },
    {
      title: '规格',
      key: 'spec',
    },
    {
      title: '供货计量单位',
      key: 'supplyUnit',
    },
    {
      title: '主计量单位',
      key: 'mainUnit',
    },
    {
      title: '理论转换率',
      key: 'theoryConverRate',
      render: (h, { row }) => {
        return <span>{ row.nowInput.theoryConverRate }</span>
      }
    },
    {
      title: '实际转换率',
      key: 'realConverRate',
      render: (h, { row }) => {
        return <span>{ row.nowInput.realConverRate }</span>
      }
    },
    {
      title: '异常转换率',
      key: 'exConverRate',
      render: (h, { row }) => {
        return <span>{ row.nowInput.exConverRate }</span>
      }
    },
    {
      title: '售价类型',
      children: [
        {
          title: '原值',
          key: 'oldSaleType',
          width: 120,
          render: (h, { row }) => {
            return (<span>{ formatSalePriceType(row.oldInput.saleType) }</span>)
          }
        },
        {
          title: '现值',
          key: 'newSaleType',
          width: 120,
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleType, row.nowInput.saleType, formatSalePriceType(row.nowInput.saleType))
          }
        }
      ]
    },
    {
      title: '实际转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldRealBackUnitPrice',
          render: (h, { row }) => {
            return <span>{ row.oldInput.realBackUnitPrice }</span>
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newRealBackUnitPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.realBackUnitPrice, row.nowInput.realBackUnitPrice)
          }
        }
      ]
    },
    {
      title: '理论转换率辅计量成本价',
      align: 'center',
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldTheoryBackUnitPrice',
          render: (h, { row }) => {
            return <span>{ row.oldInput.theoryBackUnitPrice }</span>
          }
        },
        {
          title: '现值',
          key: 'newTheoryBackUnitPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.theoryBackUnitPrice, row.nowInput.theoryBackUnitPrice)
          }
        }
      ]
    },
    {
      title: '主计量成本价',
      width: 120,
      children: [
        {
          title: '原值',
          key: 'oldMainUnitPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.mainUnitPrice }</span>)
          }
        },
        {
          title: '现值',
          key: 'newMainUnitPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitPrice, row.nowInput.mainUnitPrice)
          }
        }
      ]
    },
    {
      title: '主计量价浮动比率',
      key: 'mainUnitFloatRate',
    },
    {
      title: '加价类型',
      key: 'saleTypeStr',
    },
    {
      title: '销售面价',
      width: 120,
      children: [
        {
          title: '原值',
          key: 'oldFacePrice2',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.facePrice2 }</span>)
          }
        },
        {
          title: '现值',
          key: 'newFacePrice2',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.facePrice2, row.nowInput.facePrice2)
          }
        }
      ]
    },
    {
      title: '辅计量现金价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldBackUnitCashPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.backUnitCashPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newBackUnitCashPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitCashPrice, row.nowInput.backUnitCashPrice)
          }
        }
      ]
    },
    {
      title: '主计量现金价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldMainUnitCashPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.mainUnitCashPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newMainUnitCashPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitCashPrice, row.nowInput.mainUnitCashPrice)
          }
        }
      ]
    },
    {
      title: '现金价加价率/加价金额',
      children: [
        {
          title: '原值',
          key: 'oldCashAddRateOrMoney',
          width: 120,
          render: (h, { row }) => {
            return (<span>{ row.oldInput.cashAddRateOrMoney }</span>)
          }
        },
        {
          title: '现值',
          key: 'newCashAddRateOrMoney',
          width: 120,
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashAddRateOrMoney, row.nowInput.cashAddRateOrMoney)
          }
        }
      ]
    },
    {
      title: '现金实时加价率',
      width: 120,
      children: [{
        title: '原值',
        key: 'oldRealCashPriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realCashPriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealCashPriceAddRate',
        width: 120,
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realCashPriceAddRate, row.nowInput.realCashPriceAddRate)
        }
      }
      ]
    },
    {
      title: '现金价与原现金价浮动率',
      key: 'cashFloatRate',
    },
    {
      title: '辅计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldBackUnitDistribPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.backUnitDistribPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newBackUnitDistribPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitDistribPrice, row.nowInput.backUnitDistribPrice)
          }
        }
      ]
    },
    {
      title: '主计量分销价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldMainUnitDistribPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.mainUnitDistribPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newMainUnitDistribPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitDistribPrice, row.nowInput.mainUnitDistribPrice)
          }
        }
      ]
    },
    {
      title: '分销与现金差额/差率',
      children: [{
        title: '原值',
        key: 'oldDistribCashDiffRateOrMoney',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.distribCashDiffRateOrMoney }</span>)
        }
      },
      {
        title: '现值',
        key: 'newDistribCashDiffRateOrMoney',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.distribCashDiffRateOrMoney, row.nowInput.distribCashDiffRateOrMoney)
        }
      }
      ]
    },
    {
      title: '分销实时价加价率',
      children: [{
        title: '原值',
        key: 'oldRealDistribPriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realDistribPriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealDistribPriceAddRate',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realDistribPriceAddRate, row.nowInput.realDistribPriceAddRate)
        }
      }
      ]
    },
    {
      title: '现分销与原分销浮动率',
      key: 'distribFloatRate',
    },
    {
      title: '现分销与现金差价率',
      render: (h, { row }) => {
        return (<span>{ row.nowInput.distribCashDiffRateOrMoney }</span>)
      }
    },
    {
      title: '辅计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldBackUnitSalePrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.backUnitSalePrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newBackUnitSalePrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.backUnitSalePrice, row.nowInput.backUnitSalePrice)
          }
        }
      ]
    },
    {
      title: '主计量售价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldMainUnitSalePrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.mainUnitSalePrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newMainUnitSalePrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.mainUnitSalePrice, row.nowInput.mainUnitSalePrice)
          }
        }
      ]
    },
    {
      title: '售价标准加价金额/比例',
      children: [{
        title: '原值',
        key: 'oldSaleAddRateOrMoney',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.saleAddRateOrMoney }</span>)
        }
      },
      {
        title: '现值',
        key: 'newSaleAddRateOrMoney',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.saleAddRateOrMoney, row.nowInput.saleAddRateOrMoney)
        }
      }
      ]
    },
    {
      title: '售价实时价加价率',
      children: [{
        title: '原值',
        key: 'oldRealSalePriceAddRate',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.realSalePriceAddRate }</span>)
        }
      },
      {
        title: '现值',
        key: 'newRealSalePriceAddRate',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.realSalePriceAddRate, row.nowInput.realSalePriceAddRate)
        }
      }
      ]
    },
    {
      title: '现售价与原售价浮动率',
      key: 'saleFloatRate',
    },
    {
      title: '现金辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldCashBackUnitBatchPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.cashBackUnitBatchPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newCashBackUnitBatchPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashBackUnitBatchPrice, row.nowInput.cashBackUnitBatchPrice)
          }
        }
      ]
    },
    {
      title: '现金辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldCashBackUnitAddRateOrMoney',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.cashBackUnitAddRateOrMoney }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newCashBackUnitAddRateOrMoney',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.cashBackUnitAddRateOrMoney, row.nowInput.cashBackUnitAddRateOrMoney)
          }
        }
      ]
    },
    {
      title: '售价辅计量批量价',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldSaleBackUnitBatchPrice',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.saleBackUnitBatchPrice }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newSaleBackUnitBatchPrice',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleBackUnitBatchPrice, row.nowInput.saleBackUnitBatchPrice)
          }
        }
      ]
    },
    {
      title: '售价辅计量批量加价金额/比例',
      align: 'center',
      width: 120,
      children: [
        {
          title: '原值',
          align: 'center',
          key: 'oldSaleBackUnitAddRateOrMoney',
          render: (h, { row }) => {
            return (<span>{ row.oldInput.saleBackUnitAddRateOrMoney }</span>)
          }
        },
        {
          title: '现值',
          align: 'center',
          key: 'newSaleBackUnitAddRateOrMoney',
          render: (h, { row }) => {
            return generateHighlightNodeForSalePrice(h, row.oldInput.saleBackUnitAddRateOrMoney, row.nowInput.saleBackUnitAddRateOrMoney)
          }
        }
      ]
    },
    {
      title: '限制展示价',
      children: [{
        title: '原值',
        key: 'oldLimitShowPrice',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.limitShowPrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newLimitShowPrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitShowPrice, row.nowInput.limitShowPrice)
        }
      }
      ]
    },
    {
      title: '限制交易价',
      children: [{
        title: '原值',
        key: 'oldLimitTradePrice',
        render: (h, { row }) => {
          return (<span>{ row.oldInput.limitTradePrice }</span>)
        }
      },
      {
        title: '现值',
        key: 'newLimitTradePrice',
        render: (h, { row }) => {
          return generateHighlightNodeForSalePrice(h, row.oldInput.limitTradePrice, row.nowInput.limitTradePrice)
        }
      }
      ]
    }
  ]
}
